package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.datascope.annotation.DataScope;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SigninMapper;
import com.ruoyi.system.domain.Signin;
import com.ruoyi.system.service.ISigninService;

/**
 * 签到表Service业务层处理
 * 
 * @author hyb
 * @date 2023-02-13
 */
@Service
public class SigninServiceImpl implements ISigninService 
{
    @Autowired
    private SigninMapper signinMapper;

    /**
     * 查询签到表
     * 
     * @param id 签到表主键
     * @return 签到表
     */
    @Override
    public Signin selectSigninById(Long id)
    {
        return signinMapper.selectSigninById(id);
    }

    /**
     * 查询签到表列表
     * 
     * @param signin 签到表
     * @return 签到表
     */
    @Override
    public List<Signin> selectSigninList(Signin signin)
    {
        return signinMapper.selectSigninList(signin);
    }

    /**
     * 新增签到表
     * 
     * @param signin 签到表
     * @return 结果
     */
    @Override
    public int insertSignin(Signin signin)
    {
        signin.setCreateTime(DateUtils.getNowDate());
        return signinMapper.insertSignin(signin);
    }

    /**
     * 修改签到表
     * 
     * @param signin 签到表
     * @return 结果
     */
    @Override
    public int updateSignin(Signin signin)
    {
        signin.setUpdateTime(DateUtils.getNowDate());
        return signinMapper.updateSignin(signin);
    }

    /**
     * 批量删除签到表
     * 
     * @param ids 需要删除的签到表主键
     * @return 结果
     */
    @Override
    public int deleteSigninByIds(Long[] ids)
    {
        return signinMapper.deleteSigninByIds(ids);
    }

    /**
     * 删除签到表信息
     * 
     * @param id 签到表主键
     * @return 结果
     */
    @Override
    public int deleteSigninById(Long id)
    {
        return signinMapper.deleteSigninById(id);
    }

    @DataScope(userAlias = "a")
    @Override
    public List<Signin> selectAllSubAddSigninList(String id) {
        //只能查自己创建的活动
        Signin signin = new Signin();
        signin.setId(Long.parseLong(id));
        return signinMapper.selectAllSubAddSigninList(signin);
    }

    @Override
    public Signin selectSigninByUserIdAndActivityId(Signin signin) {
        return signinMapper.selectSigninByUserIdAndActivityId(signin);
    }

    @Override
    public List<Signin> selectSigninAllList(Signin signin) {
        return signinMapper.selectSigninAllList(signin);
    }
}
